<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>测试</title>
</head>
<body>
	<script>
		/*var arr1 = [1,2,3];

		var arr2 = arr1;
		arr1[0] = 0;
		arr2[1] = 0;
		console.log(arr1);//003
		console.log(arr2);//003*/

		function Person(name,age,sex){//构造函数
			this.name = name;
			this.age = age;
			this.sex = sex;

			this.sayName = function(){
				alert(this.name);
			}
		}

		var person1 = new Person("zhangwuji","20","man");//实例
		var person2 = new Person("zhouzhiruo","19","woman");
		//person1 和 person2 都是实例 这两个实例都有一个constructor属性 该属性指向Person

		console.log(person1.constructor === Person);
		console.log(person2.constructor === Person);
		// person1.sayName();
		// person2.sayName();
		console.log(person1.sayName == person2.sayName);
		console.log(Person.prototype);
		console.log(Person);
		//Person.prototype 是原型对象 原型对象的constructor属性是一个指针 指向Person
		console.log(Person.prototype.constructor === Person);

		Person.prototype.getName = function(){
			return this.name
		}

		console.log(person1.getName());


	</script>
	
</body>
</html>